package com.frogs.ucenter.dao.ibatis;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Repository;

import com.frogs.framework.base.dao.ibatis.BaseDaoIbatis;
import com.frogs.framework.util.PageList;
import com.frogs.ucenter.dao.FamilyBaseInfoDao;
import com.frogs.ucenter.entity.FamilyBaseInfo;
import com.frogs.ucenter.entity.ext.FamilyBaseInfoExt;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("familyBaseInfoDao")
public class FamilyBaseInfoDaoImpl extends BaseDaoIbatis<FamilyBaseInfo> implements FamilyBaseInfoDao {

    public FamilyBaseInfoDaoImpl() {
        super();
        setNameSpace( "family_base_info" );
    }

    @Required
    @Resource
    public void setSqlMapClientAutowired(SqlMapClient sqlMapClient) {
        super.setSqlMapClient( sqlMapClient );
    }

	@Override
	public FamilyBaseInfoExt selectExtByUserId(Object userId) {
		return (FamilyBaseInfoExt) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".selectExtById", userId);
	}

	@Override
	public List<FamilyBaseInfo> selectMyAllFamily(Map<String, Object> params) {
		return getSqlMapClientTemplate().queryForList(getNameSpace() + ".selectMyAllFamily", params);
	}
	
	@Override
	public PageList<FamilyBaseInfoExt> selectExtByMap(Map<String, Object> params , int page, int pagesize, boolean doCount) {
		return super.queryforPageList(getNameSpace() + ".selectExtByMap", params, page, pagesize, doCount);
	}
}